package com.sike.netty.jinjie.eventloop.executor;

import io.netty.channel.DefaultEventLoopGroup;
import io.netty.channel.EventLoopGroup;
import io.netty.util.concurrent.DefaultEventExecutorGroup;
import io.netty.util.concurrent.EventExecutorGroup;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class EventExecutorGroupTest_01 {
    public static void main(String[] args) {
        // 创建 EventExecutorGroup 对象
        EventExecutorGroup executorGroup = new DefaultEventExecutorGroup(5);

        // 获取事件循环对象
        System.out.println(executorGroup.next());
        System.out.println(executorGroup.next());
        System.out.println(executorGroup.next());
        System.out.println(executorGroup.next());
        System.out.println(executorGroup.next());

        System.out.println("");

        for (int i = 0; i < 7; i++) {
            executorGroup.next().execute(() -> {
                log.info("这是一个普通任务...");
            });
        }
    }
}
